import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routers/routers'

import NProgress from "nprogress"; // 导入 nprogress模块
import "nprogress/nprogress.css"; // 导入样式，否则看不到效果
NProgress.configure({ showSpinner: false }); // 显示右上角螺旋加载提示

Vue.use(VueRouter)

const router = new VueRouter({
    routes
})
router.beforeEach((to, from, next) => {
    NProgress.start();//加载进度条
    next()
})

router.afterEach(() => {
    NProgress.done(); //完成进度条
});

export default router
